#include<stdio.h>
#include<string.h>
#include<stdlib.h>
char* compress(char*src)
 {
 	int len=strlen(src);
 	if(len==0)
 	{
 		return src;
	 }
	 char compressed[100];
 	int index=0;
 	for(int i=0;i<len;)
 	{
 		 int count=1;
 		 while(i+count<len&&src[i]==src[i+count])
 		 {
 		 	count++;
		  }
		  if(count>=3)
		  {
		  	index+=sprintf(&compressed[index],"%c%d",src[i],count);
		  }
		  else
		  {
		  	for(int j=0;j<count;j++)
		  	{
		  		compressed[index++]=src[i];
			  }
		  }
		  i+=count;
	 }
	 compressed[index]='\0';
	 return compressed; 
 }
int main()
{
	char src[100];
	scanf("%s",src);

	char *ps = compress(src);
	
	puts(ps);
	return 0;
}
